Skip to content

feat: add platform-adaptive runtime tests#15

Merged
voltjia merged 1 commit into
masterfrom
feat/add-platform-adaptive-tests
Jul 3, 2026
Merged

feat: add platform-adaptive runtime tests#15
voltjia merged 1 commit into
masterfrom
feat/add-platform-adaptive-tests

Conversation

@voltjia

@voltjia voltjia commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace CPU/NVIDIA-specific runtime tests with one parameterized backend runtime test in tests/test_native_runtime.cc.
  • Update tests/CMakeLists.txt so enabled runtime backends instantiate the same native runtime test and define dispatch-test backend coverage macros.
  • Extend tests/test_runtime_dispatch.cc and tests/install_consumer_smoke.cc so runtime tests adapt to CPU, NVIDIA, Iluvatar, MetaX, Cambricon, Moore, and Ascend builds.
  • Add backend device-availability probing so tests skip cleanly when a configured backend has no usable device in the current container.
  • Fix Cambricon compatibility in src/native/cambricon/runtime_.h for CNRT versions that use cnrtSuccess and the queue-before-kind cnrtMemcpyAsync signature.

Motivation

InfiniRT needs to support multiple accelerator platforms, but the existing runtime tests were mostly duplicated around CPU and NVIDIA. That made new backend coverage harder to maintain and easy to miss. This PR adds a reusable test mechanism so future runtime API work can be validated consistently across all enabled platforms.

Type of Change

  • feat - new feature / new operator / new platform
  • fix - bug fix
  • perf - performance improvement (no behavioral change)
  • refactor - code restructuring without behavior change
  • test - adding or fixing tests only
  • docs - documentation only
  • build / ci - build system or CI configuration
  • chore - tooling, formatting, or other non-code changes
  • Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Smoke Test Result

git diff --check

ssh nvidia: accelerator-dev/nvidia:latest
cmake -B build -DWITH_CPU=ON -DWITH_NVIDIA=ON -DINFINI_RT_BUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
cd build && ctest --output-on-failure
100% tests passed, 0 tests failed out of 7

ssh cambricon: accelerator-dev/cambricon:latest
cmake -B build -DWITH_CPU=ON -DWITH_CAMBRICON=ON -DINFINI_RT_BUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
cd build && ctest
100% tests passed, 0 tests failed out of 7

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA Yes full passed accelerator-dev/nvidia:latest, 7/7 CTest passed
Iluvatar Yes full passed accelerator-dev/iluvatar:latest, 7/7 CTest passed
MetaX Yes full passed accelerator-dev/metax:latest, 7/7 CTest passed; CMake was installed temporarily via pip because the image did not include it
Cambricon Yes full passed accelerator-dev/cambricon:latest, 7/7 CTest passed
Moore Yes full passed accelerator-dev/moore:latest, 7/7 CTest passed
Ascend Yes full passed accelerator-dev/ascend:latest, CTest output reported 7/7 passed; SSH returned non-zero due to the known host-side issue unrelated to project tests
Full `pytest` output (optional)
N/A - this repository uses CTest for the runtime checks in this PR.

Benchmark / Performance Impact

N/A - this PR changes test coverage and a small Cambricon SDK compatibility path; it is not performance-sensitive.

Notes for Reviewers

  • Ascend install-consumer coverage validates public headers and linkage only. Runtime behavior is covered by test_ascend_runtime and test_runtime_dispatch; install-consumer runtime execution can hang in stub/no-device environments.
  • Backend runtime tests now probe device availability first and skip runtime behavior when no usable device is exposed by the container.

@voltjia voltjia changed the title Add platform-adaptive runtime tests feat: add platform-adaptive runtime tests Jul 3, 2026
@voltjia voltjia marked this pull request as ready for review July 3, 2026 05:20
@voltjia voltjia merged commit bd6b008 into master Jul 3, 2026
4 checks passed
@voltjia voltjia deleted the feat/add-platform-adaptive-tests branch July 3, 2026 05:21
voltjia added a commit that referenced this pull request Jul 3, 2026
* feat!: align runtime API and add runtime dispatch (#11)

* Align runtime API with generated wrappers

* Add default runtime dispatch specialization

* Refactor runtime dispatch namespace

* Use Abseil status for runtime device API

* Revert "Use Abseil status for runtime device API"

This reverts commit a26ddff.

* Address runtime dispatch review feedback

* Keep runtime API list in generator

* Add TensorView constructor guard test

* Align runtime memcpy kind constants with CUDA API

* Use CUDA-style runtime memcpy constants

* Use CUDA-style runtime memcpy constants

* Move TensorView tests back into core test

* Remove standalone TensorView test target

* Remove standalone TensorView test file

* Use fully qualified runtime API names in README

* style: format runtime dispatch test

* feat: refactor InfiniCore CPU runtime to InfiniRT (#8)

Co-authored-by: Jiacheng Huang <huangjiacheng0709@outlook.com>

* feat: add platform-adaptive runtime tests (#15)

* feat: add runtime backend API foundation (#14)

---------

Co-authored-by: spike-zhu <74974704+spike-zhu@users.noreply.github.com>
voltjia added a commit that referenced this pull request Jul 3, 2026
* feat!: align runtime API and add runtime dispatch (#11)

* Align runtime API with generated wrappers

* Add default runtime dispatch specialization

* Refactor runtime dispatch namespace

* Use Abseil status for runtime device API

* Revert "Use Abseil status for runtime device API"

This reverts commit a26ddff.

* Address runtime dispatch review feedback

* Keep runtime API list in generator

* Add TensorView constructor guard test

* Align runtime memcpy kind constants with CUDA API

* Use CUDA-style runtime memcpy constants

* Use CUDA-style runtime memcpy constants

* Move TensorView tests back into core test

* Remove standalone TensorView test target

* Remove standalone TensorView test file

* Use fully qualified runtime API names in README

* style: format runtime dispatch test

* feat: refactor InfiniCore CPU runtime to InfiniRT (#8)

Co-authored-by: Jiacheng Huang <huangjiacheng0709@outlook.com>

* feat: add platform-adaptive runtime tests (#15)

* feat: add runtime backend API foundation (#14)

---------

Co-authored-by: spike-zhu <74974704+spike-zhu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant